IF EXISTS (SELECT *
           FROM INFORMATION_SCHEMA.ROUTINES
           WHERE ROUTINE_NAME='pProducer_Delete'
           AND ROUTINE_SCHEMA='dbo'
           AND ROUTINE_TYPE='PROCEDURE'
          )
          DROP PROCEDURE dbo.pProducer_Delete
GO

CREATE PROC dbo.pProducer_Delete
	@id  AS INT
AS

	IF NOT EXISTS (SELECT '' FROM Product WHERE ProducerId = @id)
	 BEGIN
		 UPDATE Producer
		 SET IsDeleted = 1
		 WHERE Id = @id
	END